package com.gaussic.model;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "users", schema = "my_database")
public class UsersEntity {
    private String name;
    private Boolean sex;
    private String address;
    private String phone;
    private int id;
    private Timestamp birth;
    private Boolean signupStatus;
    private Timestamp signupAt;
    private Integer ciscId;
    private Integer committeeId;
    private String password;
    private Integer recommendId;

    @Basic
    @Column(name = "name", nullable = false, length = 20)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "sex", nullable = true)
    public Boolean getSex() {
        return sex;
    }

    public void setSex(Boolean sex) {
        this.sex = sex;
    }

    @Basic
    @Column(name = "address", nullable = true, length = 30)
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Basic
    @Column(name = "phone", nullable = true, length = 20)
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "birth", nullable = false)
    public Timestamp getBirth() {
        return birth;
    }

    public void setBirth(Timestamp birth) {
        this.birth = birth;
    }

    @Basic
    @Column(name = "signup_status", nullable = true)
    public Boolean getSignupStatus() {
        return signupStatus;
    }

    public void setSignupStatus(Boolean signupStatus) {
        this.signupStatus = signupStatus;
    }

    @Basic
    @Column(name = "signup_at", nullable = false)
    public Timestamp getSignupAt() {
        return signupAt;
    }

    public void setSignupAt(Timestamp signupAt) {
        this.signupAt = signupAt;
    }

    @Basic
    @Column(name = "cisc_id", nullable = true)
    public Integer getCiscId() {
        return ciscId;
    }

    public void setCiscId(Integer ciscId) {
        this.ciscId = ciscId;
    }

    @Basic
    @Column(name = "committee_id", nullable = true)
    public Integer getCommitteeId() {
        return committeeId;
    }

    public void setCommitteeId(Integer committeeId) {
        this.committeeId = committeeId;
    }

    @Basic
    @Column(name = "password", nullable = true, length = 20)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "recommend_id", nullable = true)
    public Integer getRecommendId() {
        return recommendId;
    }

    public void setRecommendId(Integer recommendId) {
        this.recommendId = recommendId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UsersEntity that = (UsersEntity) o;

        if (id != that.id) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (sex != null ? !sex.equals(that.sex) : that.sex != null) return false;
        if (address != null ? !address.equals(that.address) : that.address != null) return false;
        if (phone != null ? !phone.equals(that.phone) : that.phone != null) return false;
        if (birth != null ? !birth.equals(that.birth) : that.birth != null) return false;
        if (signupStatus != null ? !signupStatus.equals(that.signupStatus) : that.signupStatus != null) return false;
        if (signupAt != null ? !signupAt.equals(that.signupAt) : that.signupAt != null) return false;
        if (ciscId != null ? !ciscId.equals(that.ciscId) : that.ciscId != null) return false;
        if (committeeId != null ? !committeeId.equals(that.committeeId) : that.committeeId != null) return false;
        if (password != null ? !password.equals(that.password) : that.password != null) return false;
        if (recommendId != null ? !recommendId.equals(that.recommendId) : that.recommendId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (sex != null ? sex.hashCode() : 0);
        result = 31 * result + (address != null ? address.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);
        result = 31 * result + id;
        result = 31 * result + (birth != null ? birth.hashCode() : 0);
        result = 31 * result + (signupStatus != null ? signupStatus.hashCode() : 0);
        result = 31 * result + (signupAt != null ? signupAt.hashCode() : 0);
        result = 31 * result + (ciscId != null ? ciscId.hashCode() : 0);
        result = 31 * result + (committeeId != null ? committeeId.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (recommendId != null ? recommendId.hashCode() : 0);
        return result;
    }
}
